import request from '@/utils/request'

export function addRole(data) {
  return request({
    url: '/role/insertRole',
    method: 'post',
    data
  })
}
export function roleList(data) {
  return request({
    url: '/role/selectRolePage',
    method: 'get',
    params: data
  })
}
export function viewRole(data) {
  return request({
    url: `/role/selectRole/${data}`,
    method: 'get'
  })
}
export function updateRole(data) {
  return request({
    url: `/role/updateRole`,
    method: 'put',
    data
  })
}
export function deleteRole(data) {
  return request({
    url: `/role/deleteRole/${data}`,
    method: 'delete'
  })
}

//角色权限相关
export function viewRolePermission(data) {
  return request({
    url: `/role/selectRolePermission/${data}`,
    method: 'get'
  })
}

export function saveRolePermission(data) {
  return request({
    url: `/role/saveRolePermission`,
    method: 'post',
    data
  })
}

export function viewRoleMenuOperation(data) {
  return request({
    url: `/role/selectRoleMenuOperation/${data}`,
    method: 'get'
  })
}

export function viewRoleOperation(roleId,operationId) {
  return request({
    url: `/role/selectRoleOperation/role/${roleId}/menuOperation/${operationId}`,
    method: 'get'
  })
}


export function saveRoleOperation(data) {
  return request({
    url: `/role/saveRoleOperation`,
    method: 'post',
    data
  })
}




